<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
namespace Agp\CoreBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Bondcs\Rede\AuthorizationResponse;
use Bondcs\Rede\Authentication3dsResponse;

/**
 * Description of Cartao
 *
 * @author bondcs
 * @ORM\Table(name="retorno_transacao_rede")
 * @ORM\Entity()
 */
class RetornoTransacaoRede {
    
    public function __construct($resposta) {
        
        if ($resposta instanceof AuthorizationResponse){
            $this->cardSchema = $resposta->getCardScheme();
            $this->country = $resposta->getCountry();
            $this->issuer = $resposta->getIssuer();
            $this->msgCartao = $resposta->getMsgCartao();
            $this->statusCartao = $resposta->getStatusCartao();
            $this->nmParcela = $resposta->getParcelas();
        }
        
        if ($resposta instanceof Authentication3dsResponse){
            $this->avv = $resposta->getAvv();
            $this->cardHolderRegistred = $resposta->getCardHolderRegistred();
            $this->cavvAlgorithm = $resposta->getCavvAlgorithm();
            $this->eci = $resposta->getEci();
            $this->xid = $resposta->getXid();
        }
        
        $this->authCode = $resposta->getAuthCode();
        $this->authHostReference = $resposta->getAuthHostReference();
        $this->gatewayReference = $resposta->getGatewayReference();
        $this->merchantreference = $resposta->getMerchantreference();
        $this->mode = $resposta->getMode();
        $this->msgRede = $resposta->getMsgRede();
        $this->rawResponse = $resposta->getRawResponse();
        $this->reason = $resposta->getReason();
        $this->status = $resposta->getStatus();
        $this->statusRede = $resposta->getStatusRede();
        $this->time = $resposta->getTime();
        $this->mid = $resposta->getMid();
        
    }
    
    /**
     * @var integer $codRede
     *
     * @ORM\Column(name="cod_retorno_transacao_rede", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     *
     */
    protected $codRetornoCartao;
    
    /**
     * 
     * @ORM\Column(name="auth_code", type="string", length=42, nullable=true)
     * @var string 
     */
    protected $authCode;
    
    /**
     * 
     * @ORM\Column(name="card_scheme", type="string", length=42, nullable=true)
     * @var string 
     */
    protected $cardSchema;
    
    /**
     * 
     * @ORM\Column(name="country", type="string", length=42, nullable=true)
     * @var string 
     */
    protected $country;
    
    /**
     * 
     * @ORM\Column(name="issuer", type="string", length=42, nullable=true)
     * @var string 
     */
    protected $issuer;
    
    /**
     * 
     * @ORM\Column(name="status_cartao", type="string", length=42, nullable=true)
     * @var string 
     */
    protected $statusCartao;
    
    /**
     * 
     * @ORM\Column(name="msg_cartao", type="string", length=255, nullable=true)
     * @var string 
     */
    protected $msgCartao;
    
    /**
     * 
     * @ORM\Column(name="gateway_reference", type="string", length=255, nullable=true)
     * @var string 
     */
    protected $gatewayReference;
    
    /**
     * 
     * @ORM\Column(name="status_rede", type="string", length=42, nullable=true)
     * @var string 
     */
    protected $statusRede;
    
    /**
     * 
     * @ORM\Column(name="msg_rede", type="string", length=255, nullable=true)
     * @var string 
     */
    protected $msgRede;
    
    /**
     * 
     * @ORM\Column(name="merchant_reference", type="string", length=255, nullable=true)
     * @var string 
     */
    protected $merchantreference;
    
    /**
     * 
     * @ORM\Column(name="mode", type="string", length=255, nullable=true)
     * @var string 
     */
    protected $mode;
    
    /**
     * 
     * @ORM\Column(name="reason", type="string", length=255, nullable=true)
     * @var string 
     */
    protected $reason;
    
    /**
     * 
     * @ORM\Column(name="status", type="string", length=255, nullable=true)
     * @var string 
     */
    protected $status;
    
    /**
     * 
     * @ORM\Column(name="time", type="string", length=255, nullable=true)
     * @var string 
     */
    protected $time;
    
    /**
     * 
     * @ORM\Column(name="auth_host_reference", type="string", length=255, nullable=true)
     * @var string 
     */
    protected $authHostReference;
    
    /**
     * 
     * @ORM\Column(name="nm_parcela", type="string", length=255, nullable=true)
     * @var string 
     */
    protected $nmParcela;
    
    /**
     * 
     * @ORM\Column(name="raw_response", type="text", nullable=true)
     * @var string 
     */
    protected $rawResponse;
    
    /**
     * 
     * @ORM\Column(name="mid", type="string", length=255, nullable=true)
     * @var string 
     */
    protected $mid;
    
    /**
     * 
     * @ORM\Column(name="avv", type="string", length=255, nullable=true)
     * @var string 
     */
    protected $avv;
    
    /**
     * 
     * @ORM\Column(name="card_holder_registred", type="string", length=255, nullable=true)
     * @var string 
     */
    protected $cardHolderRegistred;
    
    /**
     * 
     * @ORM\Column(name="eci", type="string", length=255, nullable=true)
     * @var string 
     */
    protected $eci;
    
    /**
     * 
     * @ORM\Column(name="cavv_algorithm", type="string", length=255, nullable=true)
     * @var string 
     */
    protected $cavvAlgorithm;
    
    /**
     * 
     * @ORM\Column(name="xid", type="string", length=255, nullable=true)
     * @var string 
     */
    protected $xid;
    
    public function getCodRetornoCartao() {
        return $this->codRetornoCartao;
    }

    public function getAuthCode() {
        return $this->authCode;
    }

    public function getCardSchema() {
        return $this->cardSchema;
    }

    public function getCountry() {
        return $this->country;
    }

    public function getIssuer() {
        return $this->issuer;
    }

    public function getStatusCartao() {
        return $this->statusCartao;
    }

    public function getMsgCartao() {
        return $this->msgCartao;
    }

    public function getGatewayReference() {
        return $this->gatewayReference;
    }

    public function getStatusRede() {
        return $this->statusRede;
    }

    public function getMsgRede() {
        return $this->msgRede;
    }

    public function getMerchantreference() {
        return $this->merchantreference;
    }

    public function getMode() {
        return $this->mode;
    }

    public function getReason() {
        return $this->reason;
    }

    public function getStatus() {
        return $this->status;
    }

    public function getTime() {
        return $this->time;
    }

    public function getAuthHostReference() {
        return $this->authHostReference;
    }

    public function getRawResponse() {
        return $this->rawResponse;
    }

    public function setCodRetornoCartao($codRetornoCartao) {
        $this->codRetornoCartao = $codRetornoCartao;
    }

    public function setAuthCode($authCode) {
        $this->authCode = $authCode;
    }

    public function setCardSchema($cardSchema) {
        $this->cardSchema = $cardSchema;
    }

    public function setCountry($country) {
        $this->country = $country;
    }

    public function setIssuer($issuer) {
        $this->issuer = $issuer;
    }

    public function setStatusCartao($statusCartao) {
        $this->statusCartao = $statusCartao;
    }

    public function setMsgCartao($msgCartao) {
        $this->msgCartao = $msgCartao;
    }

    public function setGatewayReference($gatewayReference) {
        $this->gatewayReference = $gatewayReference;
    }

    public function setStatusRede($statusRede) {
        $this->statusRede = $statusRede;
    }

    public function setMsgRede($msgRede) {
        $this->msgRede = $msgRede;
    }

    public function setMerchantreference($merchantreference) {
        $this->merchantreference = $merchantreference;
    }

    public function setMode($mode) {
        $this->mode = $mode;
    }

    public function setReason($reason) {
        $this->reason = $reason;
    }

    public function setStatus($status) {
        $this->status = $status;
    }

    public function setTime($time) {
        $this->time = $time;
    }

    public function setAuthHostReference($authHostReference) {
        $this->authHostReference = $authHostReference;
    }

    public function setRawResponse($rawResponse) {
        $this->rawResponse = $rawResponse;
    }

    public function getNmParcela() {
        return $this->nmParcela;
    }

    public function setNmParcela($nmParcela) {
        $this->nmParcela = $nmParcela;
    }

    public function getMid() {
        return $this->mid;
    }

    public function setMid($mid) {
        $this->mid = $mid;
    }
    
    public function getAvv() {
        return $this->avv;
    }

    public function getCardHolderRegistred() {
        return $this->cardHolderRegistred;
    }

    public function getEci() {
        return $this->eci;
    }

    public function getCavvAlgorithm() {
        return $this->cavvAlgorithm;
    }

    public function getXid() {
        return $this->xid;
    }

    public function setAvv($avv) {
        $this->avv = $avv;
    }

    public function setCardHolderRegistred($cardHolderRegistred) {
        $this->cardHolderRegistred = $cardHolderRegistred;
    }

    public function setEci($eci) {
        $this->eci = $eci;
    }

    public function setCavvAlgorithm($cavvAlgorithm) {
        $this->cavvAlgorithm = $cavvAlgorithm;
    }

    public function setXid($xid) {
        $this->xid = $xid;
    }

}

?>
